﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gds.Model.ConfigModel.BasicSystemInfo
{
    public class UserInfo : INotifyPropertyChanged
    {
        private int _itemIndex;
        private string _userName;
        private string _password;
        private string _areaName;
        private string _childAreaName;
        private List<string> _childAreaNameList;
        private DataEnum.Enum_UserLevel _level;
        private string _connectType;
        private AdminModel _clientAdminModel;
        private List<BindingAreaModel> _bindingAreaModels = new List<BindingAreaModel>();
        private bool _isLoadLEL;
        private string _serverTime;
        public int ItemIndex
        {
            get { return _itemIndex; }
            set
            {
                _itemIndex = value;
                OnPropertyChanged("ItemIndex");
            }
        }
        public string UserName
        {
            get { return _userName; }
            set
            {
                _userName = value;
                OnPropertyChanged("UserName");
            }
        }
        public string Password
        {
            get { return _password; }
            set
            {
                _password = value;
                OnPropertyChanged("Password");
            }
        }
        public string AreaName
        {
            get { return _areaName; }
            set
            {
                _areaName = value;
                OnPropertyChanged("AreaName");
            }
        }
        public string ChildAreaName
        {
            get { return _childAreaName; }
            set
            {
                _childAreaName = value;
                OnPropertyChanged("ChildAreaName");
            }
        }
        public List<string> ChildAreaNameList
        {
            get { return _childAreaNameList; }
            set
            {
                _childAreaNameList = value;
                OnPropertyChanged("ChildAreaNameList");
            }
        }
        public AdminModel ClientAdminModel
        {
            get { return _clientAdminModel; }
            set
            {
                _clientAdminModel = value;
                OnPropertyChanged("ClientAdminModel");
            }
        }
        /// <summary>
        /// 该用户管理的分区 以及子分区
        /// </summary>
        public List<BindingAreaModel> BindingAreaModels
        {
            get { return _bindingAreaModels; }
            set
            {
                _bindingAreaModels = value;
                OnPropertyChanged("BindingAreaModels");
            }
        }
        /// <summary>
        ///开发者=-1,
        ///服务器=0,
        ///管理员=1,
        ///工控机通讯端=2,
        ///工控机显示端=3,
        ///客户端操作员=4,
        ///客户端浏览员=5,
        /// </summary>
        public Model.DataEnum.Enum_UserLevel Level
        {
            get { return _level; }
            set
            {
                _level = value;
                OnPropertyChanged("Level");
            }
        }
        public string ConnectType
        {
            get { return _connectType; }
            set
            {
                _connectType = value;
                OnPropertyChanged("ConnectType");
            }
        }
        /// <summary>
        /// 是否只加载可燃探头
        /// </summary>
        public bool IsLoadLEL
        {
            get { return _isLoadLEL; }
            set
            {
                _isLoadLEL = value;
                OnPropertyChanged("IsLoadLEL");
            }
        }
        public string ServerTime
        {
            get
            {
                return _serverTime;
            }
            set
            {
                _serverTime = value;
                OnPropertyChanged("ServerTime");
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

    public class BindingAreaModel : INotifyPropertyChanged
    {
        private int _bindingItemIndex;
        private string _bindingAreaName;
        private string _bindingChildName;

        /// <summary>
        /// 序号
        /// </summary>
        public int BindingItemIndex
        {
            get { return _bindingItemIndex; }
            set
            {
                _bindingItemIndex = value;
                OnPropertyChanged("BindingItemIndex");
            }
        }
        /// <summary>
        /// 绑定分区名
        /// </summary>
        public string BindingAreaName
        {
            get { return _bindingAreaName; }
            set
            {
                _bindingAreaName = value;
                OnPropertyChanged("BindingAreaName");
            }
        }
        /// <summary>
        /// 绑定分区的子分区名
        /// </summary>
        public string BindingChildName
        {
            get { return _bindingChildName; }
            set
            {
                _bindingChildName = value;
                OnPropertyChanged("BindingChildName");
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        public virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }

        }
    }
}
